package com.app.ryjy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 薪酬福利枚举
 */
@AllArgsConstructor
@Getter
public enum CompensationBenefitEnum {
    // 带薪休假
    PAID_LEAVE("带薪休假", 0, -1),
    // 交通补贴
    TRAFFIC_SUBSIDY("交通补贴", 1, -1),
    // 节日福利
    FESTIVAL_BENEFITS("节日福利", 2, -1),
    // 出差补助
    BUSINESS_TRIP_SUBSIDY("出差补助", 3, -1),
    // 员工体检
    EMPLOYEE_PHYSICAL_EXAMINATION("员工体检", 4, -1),
    // 五险一金
    FIVE_SOCIAL_INSURANCES_AND_ONE_HOUSING_FUND("五险一金", 5, -1);

    private final String desc;
    private final int code;
    private final int bizCode;

    /**
     * 根据 bizCode 获取 code
     *
     * @param bizCode bizCode
     * @return code
     */
    public static int getCodeByBizCode(int bizCode) {
        for (CompensationBenefitEnum status : values()) {
            if (status.getBizCode() == bizCode) {
                return status.getCode();
            }
        }
        throw new RuntimeException("bizCode 不存在");
    }

    public static void main(String[] args) {
        System.out.println(CompensationBenefitEnum.getCodeByBizCode(-1));
    }
}